package com.sgb.kjwl.view.ui.adapter.transport;

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.transport.SingleItemEntity;
import com.sgb.kjwl.utils.DefaultUtil;

import java.util.List;

/**
 * @author: 杨畔
 * @date: 2021/8/27 15:58
 * @Description: 地图报价弹窗信息适配器
 */
public class MapQuoteInfoAdapter extends BaseQuickAdapter<SingleItemEntity, BaseViewHolder> {
    public MapQuoteInfoAdapter(@Nullable List<SingleItemEntity> data) {
        super(R.layout.app_item_map_quote_info, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SingleItemEntity item) {
        helper.setText(R.id.tv_key, DefaultUtil.getString(item.getLeftString()))
                .setText(R.id.tv_value, DefaultUtil.getString(item.getRightString()));
        //设置文字颜色
        if (item.getRightColor() != 0) {
            helper.setTextColor(R.id.tv_value, ContextCompat.getColor(mContext, item.getRightColor()));
        } else {
            helper.setTextColor(R.id.tv_value, ContextCompat.getColor(mContext, R.color.color_333333));
        }
    }
}
